package com.lemo.controller;

import com.lemo.entity.FomwUser;
import com.lemo.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

/**
 * @名称: UserController
 * @描述:
 * @作者: liming
 * @时间: 2017/10/30
 * @版本: 1.0
 */
@RestController
@RequestMapping("user")
public class UserController {

    private static final Logger LOGGER = LoggerFactory.getLogger(UserController.class);

    @Resource
    private UserService userService;

    @GetMapping("save")
    public void saveUser() {

        FomwUser user = new FomwUser();
        user.setId(new BigDecimal("66666"));
        user.setUserEmail("lm455261979@163.com");
        user.setUserName("liming test");
        try {
            userService.insertSelective(user);
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
    }

    @GetMapping("list")
    public List<FomwUser> listUser() {
        List<FomwUser> fomwUsers = null;
        try {
            fomwUsers = userService.selectList(null);
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return fomwUsers;
    }

}

/**
 * 文件：UserController.java
 * 版权所有
 */


